#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <ctime>

int bubble(int * mass, std::string name)
{
    time_t time1;
    unsigned int start_time =  clock();

    
	for(int i = 0; i < 28; ++i)
	{
		for(int j = 0; j < 28-i; j++)
		{
			if(mass[j] > mass[j+1])
			{
				int tmp = mass[j];
				mass[j] = mass[j+1];
				mass[j+1] = tmp;
			}
		}
	}

    unsigned int end_time = clock();
    unsigned int search_time = end_time - start_time;
    std::cout << name << " " << search_time << " milliseconds" << std::endl;

    
    return 0;
}

int pr(std::string name){
    int ind = 0;
    
    int mass[28];
    std::ifstream file(name+".txt");
    std::string str;
    while(std::getline(file,str)) 
    {
        ind++;
        mass[ind]  = std::stoi(str);
    }
    bubble(mass, name);
    return 0;
}

int main(){
    pr("m1_sorted");
    pr("m2_reverse");
    pr("m3_shuffle");
    return 0;
}